#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    QString content = readContent2();

    ui->plainTextEdit->setPlaceholderText(content);
}

MainWindow::~MainWindow()
{
    delete ui;
}

QString MainWindow::readContent()
{
    QString content;
    QFile file("in.txt");
    bool b = file.open(QIODevice::ReadWrite | QIODevice::Text);
    if(b)
    {
        QTextStream in(&file);
        while (!in.atEnd()) {
            content.append(in.readLine() +"\n");
        }
    }
    qDebug() << content;
    return content;
}

QString MainWindow::readContent2()
{
    QString content;
    QFile file("in.txt");
    bool b = file.open(QIODevice::ReadOnly | QIODevice::Text);
    if(b)
    {
        QTextStream in(&file);
        QString line = in.readLine();
        while (!line.isNull()) {
            content.append(in.readLine());
            line = in.readLine();

            qDebug() << in.readLine() ;
        }
    }
    return content;
}

